#!/bin/bash

java -server -Xms4g -Xmx4g -Xmn2g -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m \
  -XX:MaxDirectMemorySize=1g -XX:SurvivorRatio=10 \
  -XX:+UseConcMarkSweepGC -XX:CMSMaxAbortablePrecleanTime=5000 -XX:+CMSClassUnloadingEnabled \
  -XX:CMSInitiatingOccupancyFraction=80 -XX:+UseCMSInitiatingOccupancyOnly -XX:+ExplicitGCInvokesConcurrent \
  -Dsun.rmi.dgc.server.gcInterval=43200000 -Dsun.rmi.dgc.client.gcInterval=43200000 \
  -XX:ParallelGCThreads=4 -Xlog:gc*:/logs/gc.log:time \
  -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/logs/java.hprof \
  -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=30000 \
  -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom \
  -jar /app.jar
